package com.example.happiness.controller.user;

import com.example.happiness.pojo.Feedback;
import com.example.happiness.pojo.uservo.UserReviewsVO;
import com.example.happiness.result.Result;
import com.example.happiness.service.user.UserFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "反馈相关接口")
@Slf4j
@RestController
@RequestMapping("/user/feedback")
public class UserFeedbackController {

    @Autowired
    UserFeedbackService userFeedbackService;

    @PostMapping("/addfeedback")
    @ApiOperation("添加反馈")
    public Result addFeedback(@RequestBody Feedback feedback){
        userFeedbackService.addFeedback(feedback);
        return Result.success();
    }

    @GetMapping("/getfeedback")
    @ApiOperation("获取反馈")
    public Result<List<UserReviewsVO>> getFeedback(String userid){
        List<UserReviewsVO> feedbacks = userFeedbackService.getFeedback(userid);
        return Result.success(feedbacks);

    }
}
